package cn.ihelloworld.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.ihelloworld.bean.Tag;
import cn.ihelloworld.dao.ITagDao;
import cn.ihelloworld.dao.Pagation;
import cn.ihelloworld.service.ITagService;
@Service
@Transactional
public class TagServiceImpl implements ITagService {

	@Autowired
	private ITagDao tagDao;
	
	@Override
	public Tag get(String id) {
		// TODO Auto-generated method stub
		return tagDao.get(id);
	}

	@Override
	public List<Tag> select(Tag t) {
		// TODO Auto-generated method stub
		return tagDao.select(t);
	}

	@Override
	public Pagation<Tag> selectForPage(Tag t, int currentPage, int pageSize) {
		// TODO Auto-generated method stub
		return tagDao.selectForPage(t, currentPage, pageSize);
	}

	@Override
	public void saveOrUpdate(Tag t) {
		// TODO Auto-generated method stub
		tagDao.saveOrUpdate(t);
	}

	@Override
	public void delete(String id) {
		// TODO Auto-generated method stub
		tagDao.delete(id);
	}

	@Override
	public void delete(String[] ids) {
		// TODO Auto-generated method stub
		tagDao.delete(ids);
	}

	@Override
	public List<Tag> selectHot(int num) {
		// TODO Auto-generated method stub
		return tagDao.selectHot(num);
	}

	@Override
	public void saveOrUpdate(List<Tag> list) {
		// TODO Auto-generated method stub
		for(Tag tag:list){
			tagDao.saveOrUpdate(tag);
		}
	}

	@Override
	public void updateReadCountByName(String name) {
		// TODO Auto-generated method stub
		tagDao.updateReadCountByName(name);
	}

}
